{include file='common/header' /}
<div class="row">
    <div class="col-md-3">
        {include file='common/left' /}
    </div>
    <div class="col-md-9">
        <div class="panel panel-default">
            <div class="panel-body">
                <h3>留言列表</h3>
                <hr>
                {foreach name='lists' item='vo'}
                    <div class="media">
                        <div class="media-left">
                            <div style="width:60px;">
                                <img src="{:get_root()}/static/index/image/avatar.gif" alt="">
                            </div>
                        </div>
                        <div class="media-body">
                            <p class="alert alert-info">{$vo.content}</p>
                        </div>
                        <div class="media-right">
                            <div style="width:60px;"></div>
                        </div>
                    </div>
                    {notempty name='vo.reply'}
                    <div class="media">
                        <div class="media-left">
                            <div style="width:60px;"></div>
                        </div>
                        <div class="media-body">
                            <p class="alert alert-danger">{$vo.reply}</p>
                        </div>
                        <div class="media-right">
                            <div style="width:60px;">
                                <img src="{:get_root()}/static/index/image/sign.png" alt="">
                            </div>
                        </div>
                    </div>
                    {/notempty}
                    <hr>
                {/foreach}
                {$page}
                <h3>我要留言</h3>
                <form class="form-horizontal well" id="guestbook" method="post" onsubmit="return EBCMS.AUTH.guestbook();" action="{:url('index/guestbook/index')}">
                    <div class="form-group">
                        <label for="inputnickname3" class="col-sm-2 control-label">昵称</label>
                        <div class="col-sm-10">
                            <input name="nickname" type="text" class="form-control" id="inputnickname3">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputcontent3" class="col-sm-2 control-label">内容</label>
                        <div class="col-sm-10">
                            <textarea name="content" id="inputcontent3" class="form-control" rows="6"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputmobile3" class="col-sm-2 control-label">电话</label>
                        <div class="col-sm-10">
                            <input type="text" name="mobile" class="form-control" id="inputmobile3">
                        </div>
                    </div>
                    {if condition="ebconfig('guestbook.verify')"}
                        {include file='common/verify' /}
                    {/if}
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="submit" class="btn btn-default">提交</button>
                        </div>
                    </div>
                </form>
                <script>
                    Namespace.register("EBCMS.AUTH");
                    $(function(){
                        EBCMS.AUTH.guestbook = function(){
                            $.ajax({
                                url: '{:url('index/guestbook/index')}',
                                type: 'POST',
                                dataType: 'json',
                                data: $('#guestbook').serialize(),
                                success:function(data){
                                    if (data.code) {
                                        alert(data.msg);
                                        self.location=data.url;
                                    }else{
                                        alert(data.msg);
                                        EBCMS.FN.change_verify('#verify_img');
                                    }
                                }
                            });
                            return false;
                        };
                    });
                </script>
            </div>
        </div>
    </div>
</div>
{include file='common/footer' /}